<?php


class Holidaydirectory extends CI_Controller {
    
    public function __construct() {
        parent::__construct();
        $this->load->helper('url');
        $this->load->database();
        $this->load->model('Pet');
        $this->load->model('Utente');
        $this->load->model('Service');
        $this->load->model('Address');
        $this->load->library('pagination');
    }
    
    public function index(){
        
        
        $data['title'] = "Utenti - Holiday Dog";
        $data['keywords'] = "Utenti Holiday Dog, Pet Sitter, Pet Owner, Pet";
        $data['description'] = "Lista di Tutti gli Utenti di HolidayDog";
        $data['robots'] = "noindex, follow";
        $data['type'] = "website";
        $data['image'] = base_url(). "images/samples/slide1.jpg";
        $data['url'] = base_url() . "holidaydirectory";
        $this->load->view('layout/head', $data);
        $this->load->view('layout/header');
        $this->load->view('layout/nav');
        $city = $this->Pet->avaible_city();
        $users = $this->Pet->get_all_pet_sitter();
        if(sizeof($users) < 1){
            redirect('/holidaydirectory', 'location', 301);
        }
        
        $data['users'] = $users;
        $data['city'] = $city;
        $this->load->view('contenuti/listautenti', $data);
        $this->load->view('layout/footer');
        $this->load->view('layout/end_main');
        $this->load->view('layout/script_section');
        $this->load->view('layout/end');
        
    }
    public function PetSitter(){
        $data['title'] = "Utenti - Pet Sitter - Holiday Dog";
        $data['keywords'] = "Utenti Holiday Dog, Pet Sitter";
        $data['description'] = "Lista di Tutti i Pet Sitter HolidayDog";
        $data['robots'] = "noindex, follow";
        $data['type'] = "website";
        $data['image'] = base_url(). "images/samples/slide2.jpg";
        $data['url'] = base_url() . "holidaydirectory/PetSitter";
        $this->load->view('layout/head', $data);
        $this->load->view('layout/header');
        $this->load->view('layout/nav');
        $city = $this->Pet->avaible_city();
        $users = $this->Pet->get_all_pet_sitter();
        if(sizeof($users) < 1){
                    redirect('/holidaydirectory', 'location', 301);
                }
        
        $data['users'] = $users;
        $data['city'] = $city;
        $this->load->view('contenuti/listautenti', $data);
        $this->load->view('layout/footer');
        $this->load->view('layout/end_main');
        $this->load->view('layout/script_section');
        $this->load->view('layout/end');
    }
    public function PetOwner(){
        $data['title'] = "Utenti - Pet Owner - Holiday Dog";
        $data['keywords'] = "Utenti Holiday Dog, Pet Owner";
        $data['description'] = "Lista di Tutti i Pet Owner HolidayDog";
        $data['robots'] = "noindex, follow";
        $data['type'] = "website";
        $data['image'] = base_url(). "images/samples/slide3.jpg";
        $data['url'] = base_url() . "holidaydirectory/PetOwner";
        $this->load->view('layout/head', $data);
        $this->load->view('layout/header');
        $this->load->view('layout/nav');
        $city = $this->Pet->avaible_city();
        $users = $this->Pet->get_all_pet_owner();
        if(sizeof($users) < 1){
            redirect('/holidaydirectory', 'location', 301);
        }
        $data['users'] = $users;
        $data['city'] = $city;
        $this->load->view('contenuti/listautenti', $data);
        $this->load->view('layout/footer');
        $this->load->view('layout/end_main');
        $this->load->view('layout/script_section');
        $this->load->view('layout/end');
    }
    public function Pet(){
        $data['title'] = "Utenti - Pet - Holiday Dog";
        $data['keywords'] = "Utenti Holiday Dog, Pet";
        $data['description'] = "Lista di Tutti i Pet HolidayDog";
        $data['robots'] = "noindex, follow";
        $data['type'] = "website";
        $data['image'] = base_url(). "images/comefunziona/pet_owner.jpg";
        $data['url'] = base_url() . "holidaydirectory/Pet";
        $this->load->view('layout/head', $data);
        $this->load->view('layout/header');
        $this->load->view('layout/nav');
        $city = $this->Pet->avaible_city();
        $users = $this->Pet->get_all_pet();
        if(sizeof($users) < 1){
            redirect('/holidaydirectory', 'location', 301);
        }
        $data['users'] = $users;
        $data['city'] = $city;
        $this->load->view('contenuti/directory/listautenti_pet', $data);
        $this->load->view('layout/footer');
        $this->load->view('layout/end_main');
        $this->load->view('layout/script_section');
        $this->load->view('layout/end');
    }
    public function Citta($name){
        $data['title'] = "Lista Utenti Holiday Dog in ". $name;
        $data['keywords'] = "Utenti Holiday Dog, Pet Sitter, Pet Owner ". $name;
        $data['description'] = "Lista di Tutti gli Utenti di HolidayDog per Citta: " . $name;
        $data['robots'] = "noindex, follow";
        $data['type'] = "website";
        $data['image'] = base_url(). "images/comefunziona/pet_sitter.jpg";
        $data['url'] = base_url() . "holidaydirectory/Citta/" . $name;
        $this->load->view('layout/head', $data);
        $this->load->view('layout/header');
        $this->load->view('layout/nav');
        $city = $this->Pet->avaible_city();
        
        //query di tutti per città
        $users = $this->Pet->get_all_by_city($name);
        if(sizeof($users) < 1){
            redirect('/holidaydirectory', 'location', 301);
        }
        $data['users'] = $users;
        $data['city'] = $city;
        $this->load->view('contenuti/listautenti', $data);
        $this->load->view('layout/footer');
        $this->load->view('layout/end_main');
        $this->load->view('layout/script_section');
        $this->load->view('layout/end');
    }
}
